###
 # @Company: TWL
 # @Author: xue jian
 # @Email: xuejian@kanzhun.com
 # @Date: 2020-09-14 17:16:50
### 
echo $#
if (( $# >= 1 ))
then 

    today=$1
    if [ ! -d "$today" ]
    then
        mkdir $today
    fi

    sql="select t.boss_id,t.job_id,t.geek_id,t.exp_id,page,rank,list_time,deal_time,detailed_deal_type,lid,req_id,sessionid,deal_type,boss_position,
    boss_comp_scale, boss_comp_stage, boss_city, boss_cmp_level, boss_l1code,boss_l2code,jh, jl, job_workyears, job_degree, t1.job_feature,geek_position, 
    eh, el, geek_city, geek_gender, geek_rev_age, geek_l1code, geek_l2code,geek_apply_status, geek_latest_work_position_id, t2.exp_feature,geek_workyears, 
    geek_cmp_level,geek_degree, geek_degree_new, geek_major, geek_school_level from (select boss_id,job_id,geek_id,exp_id,page,rank,list_time,deal_time,
    if(detailed_deal_type='list-refuse','list',deal_type) as deal_type,detailed_deal_type,lid,req_id,sessionid,boss_position, boss_comp_scale, 
    boss_comp_stage, boss_city, boss_cmp_level, boss_l1code,boss_l2code,jh, jl, job_workyears, job_degree, geek_position, eh, el, geek_city, 
    geek_gender, geek_rev_age, geek_l1code, geek_l2code,geek_apply_status, geek_latest_work_position_id,geek_workyears, geek_cmp_level,geek_degree, 
    geek_degree_new, geek_major, geek_school_level,case when deal_type in ('addf','chat','success') then 1 when deal_type in ('list','det','refuse') 
    then rand() end as prob from arc.geekrec_train_rtf_all where ds='${today}' and source in ('f1_rec','f1_nearest','f1_latest') ) t    
    left join arc_five_dev.job_word_weight t1 on t.job_id=t1.job_id 
    left join arc_five_dev.exp_word_weight t2 on t.exp_id=t2.exp_id where prob>=0.95 
    sort by list_time limit 2000000000;"
    # echo "${sql}"
    hive -e "${sql}"  > $today/out
else
    echo "you should enter the date!"
fi